class Tag
  include Mongoid::Document

  field :name, type: String
  field :scope_name, type: String # used by system tag(top...)

  def get_topics
    self.scope_name.nil? ?
      Topic.where({ tag_ids: self.id }) :
      Topic.send(self.scope_name.to_sym)
  end
end
